package com.situ.day5.inter;

import org.junit.Test;

public class Demo {

    @Test
    public void test1() {
        DaYan daYan = new DaYan();
        daYan.fly();
        daYan.egg();
        daYan.print();

        //从抽象的鸟的角度去看DaYan，只能看到AbstractBird定义的功能
        AbstractBird bird = new DaYan();
        bird.egg();
        //Cannot resolve method 'fly' in 'AbstractBird'
        //bird.fly();
        //bird.print();
        bird = new GeZi();
        bird.egg();

        //从能不能飞的角度去看DaYan只能看到fly这个方法
        IFly fly = new DaYan();
        fly.fly();
        //fly.egg();
        fly = new GeZi();
        fly.fly();

    }

    public void show(IFly fly) {
        fly.fly();
    }
}
